---
description: Ensures that classes use allowed lifecycle method in its body.
options: null
optionsDescription: Not configurable.
rationale: |-

  Some lifecycle methods can only be used in certain class types.
  For example, ngOnInit() method should not be used
  in an @Injectable class.
      
ruleName: contextual-lifecycle
type: functionality
typescriptOnly: true
layout: rule
title: 'Rule: contextual-lifecycle'
optionsJSON: 'null'
---